Skip to content

fix(AdornerLayer): remove dead _layoutDirty infrastructure (CS0414)#7

Merged
oysteinkrog merged 1 commit into
if/mainfrom
fix/adornerlayer-remove-dead-layoutdirty
May 17, 2026
Merged

fix(AdornerLayer): remove dead _layoutDirty infrastructure (CS0414)#7
oysteinkrog merged 1 commit into
if/mainfrom
fix/adornerlayer-remove-dead-layoutdirty

Conversation

@oysteinkrog
Copy link
Copy Markdown
Member

Summary

Follow-up cleanup for #6 (f703b12ae) to unblock the if.81 nuget publish.

The prior PR removed the unsafe _layoutDirty gate from OnLayoutUpdated but deliberately kept the surrounding plumbing — field, HashSet, subscribe/unsubscribe helpers, and per-element LayoutUpdated handler — so the change diff was minimal and reversible. CI builds with TreatWarningsAsErrors=true, and the now write-only field trips:

error CS0414: The field 'AdornerLayer._layoutDirty' is assigned but its value is never used

This is the planned cleanup. Removes:

  • private bool _layoutDirty field
  • private HashSet<UIElement> _subscribedElements field
  • OnAdornedElementLayoutUpdated handler
  • SubscribeToElementLayout / UnsubscribeFromElementLayout helpers
  • All call sites that armed _layoutDirty (in Add, Remove, Update, Update(UIElement), SetAdornerZOrder)
  • Per-element LayoutUpdated subscription from Add/Remove
  • Stale TODO regression-test comment block referring to the removed fast path

Net behavior

Unchanged from f703b12ae. The gate was already removed there, so the write-only assignments and unread subscriptions had no observable effect — this just stops emitting them.

Validation

  • Local managed-only PresentationFramework build (build-pf-local.bat): 0 Warning(s) 0 Error(s)
  • CI on this PR
  • Auto-publish via build.yml on merge → InitialForce.WPF 10.0.0-if.81

🤖 Generated with Claude Code

Follow-up to f703b12. The previous PR removed the unsafe _layoutDirty
gate from OnLayoutUpdated but kept the field and its surrounding plumbing
(Subscribe/Unsubscribe/OnAdornedElementLayoutUpdated + _subscribedElements
HashSet) to keep that diff minimal and reversible. CI builds with
TreatWarningsAsErrors=true, so the now-unused field trips CS0414
("The field 'AdornerLayer._layoutDirty' is assigned but its value is
never used") and blocks the if.81 publish.

This is the planned cleanup. Removes:
- _layoutDirty field (read-eliminated by the prior commit)
- _subscribedElements HashSet
- OnAdornedElementLayoutUpdated handler
- SubscribeToElementLayout / UnsubscribeFromElementLayout helpers
- All call sites that armed _layoutDirty (Add/Remove/Update/SetAdornerZOrder)
- Per-element LayoutUpdated subscription from Add/Remove

Net behavior unchanged from f703b12 - the gate was already removed,
so these write-only assignments and unread subscriptions had no
observable effect.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@oysteinkrog oysteinkrog merged commit bbc8bfe into if/main May 17, 2026
7 of 8 checks passed
@oysteinkrog oysteinkrog deleted the fix/adornerlayer-remove-dead-layoutdirty branch May 17, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant